<template>
	<u-popup :show="show" mode="left"  
	@close="closeDrawer" 
	@open="openDrawer" 
	:closeable="true" 
	overlayOpacity="0.4" 
	:safeAreaInsetTop="true"
	closeIconPos="top-left"
	>
        <view class="list">
            <view class="list1" @click="toIndex">
            	<view class="word">
            		{{$data.$language.home}}
            	</view>
				<image src="../../static/yibiaopan_slices/_xialajiantouxiao.png"></image>
            </view>
			
			<view class="list1 list2" @click="RechargeBtn">
				<view class="word">
					{{$data.$language.Recharge}}
				</view>
				<image src="../../static/yibiaopan_slices/_xialajiantouxiao.png"></image>
			</view>
			
			<view class="list1 list2" @click="toDetails">
				<view class="word">
					{{$data.$language.dvtitle}}
				</view>
				<image src="../../static/yibiaopan_slices/_xialajiantouxiao.png"></image>
			</view>
			
			<view class="list1 list2" @click="toQuota">
				<view class="word">
					{{$data.$language.woneipw}}
				</view>
				<image src="../../static/yibiaopan_slices/_xialajiantouxiao.png"></image>
			</view>
			
			<view class="list1 list2" @click="toVip">
				<view class="word">
					{{$data.$language.drword1}}
				</view>
				<image src="../../static/yibiaopan_slices/_xialajiantouxiao.png"></image>
			</view>
			
			<view class="list1 list2" @click="toCommunity">
				<view class="word">
					{{$data.$language.drword2}}
				</view>
				<image src="../../static/yibiaopan_slices/_xialajiantouxiao.png"></image>
			</view>
			
			<view class="list1 list2" @click="Password">
				<view class="word">
					<!-- 密码设置 -->
					{{$data.$language.mimashezhi}}
				</view>
				<image src="../../static/yibiaopan_slices/_xialajiantouxiao.png"></image>
			</view>
			
			<view class="list1 list3">
				<view class="word">
					{{$data.$language.drword3}}
				</view>
			</view>
			
			<view class="list1 list3">
				<view class="word">
					{{$data.$language.drword4}}
				</view>
			</view>
			
			<view class="list1 list3">
				<view class="word">
					{{$data.$language.drword5}}
				</view>
			</view>
			
			<view class="list1 list3">
				<view class="word">
					{{$data.$language.drword6}}
				</view>
			</view>
			<!-- <view class="list1 list3" @click="Logoutlogin">
				<view class="word">
					{{$data.$language.outLogin}}
				</view>
			</view> -->
			
        </view>
	</u-popup>
</template>
<script>
	import zhCN from '@/locales/zh-CN.js'
	import enUS from '@/locales/en-US.js'
	import trCN from '@/locales/tr-CN.js'
	import {
		getMYsix,
	} from '@/api/index.js';
  export default {
	props:{
		  show:{
			  type:Boolean,
			  default:false
		  }
	  },
    data() {
      return {
        $language:uni.getStorageSync('locale')=='en-US'? enUS:zhCN,
		indexshoebox:0,
      }
    },
	created() {
		var translate = uni.getStorageSync('locale')
		if(translate=='en-US'){
			this.$data.$language = enUS
		}else if(translate=='zh-CN'){
			this.$data.$language = zhCN
		}else{
			this.$data.$language = trCN
		}
		this.loagistxs()
	},
    methods: {
		// 获取自己资料
		loagistxs() {
			getMYsix((data) => {
					console.log(data.data)
					this.indexshoebox = data.data.parent_id
				},
				(errorMsg) => {
					var that = this
					// uni.clearStorage()
					// this.getcurentAddress()
					// 处理请求失败或错误的情况
					console.error(errorMsg);
				}
			);
		},
		RechargeBtn() {
			if(this.indexshoebox == 0 || this.indexshoebox == '' || this.indexshoebox ==null || this.indexshoebox == undefined){
				var jjfihbi = this.$data.$language.jjfihbi
				uni.showToast({
					title:jjfihbi,
					icon:"none",
					duration:2000,
				})
				return
			}else{
				uni.navigateTo({
					url: '/pages/Recharge/Recharge'
				});
			}
			
		},
		Logoutlogin(){
			uni.clearStorage()
			uni.redirectTo({
				url:'/pages/login/login'
			})
		},
		Password(){
			uni.navigateTo({
				url: '/pages/buyNodes/Password'
			});
		},
		refreshLanguage(locale) {
		      if (locale === 'zh-CN') {
		        this.$language = zhCN
		      } else if (locale === 'en-US') {
		        this.$language = enUS
		      }else{
					  this.$language = trCN
				}
			  
		},
      openDrawer() {
        // console.log('open');
      },
      closeDrawer() {
        // this.show = false
		this.$emit('close')
        // console.log('close');
      },
	  toIndex(){
		  this.$emit('close')
		  uni.redirectTo({
		  	url:'/pages/index/index'
		  })
		  
		  // this.$emit('close')
	  },
	  toDetails(){
		  uni.navigateTo({
		  	url:'/pages/details/details'
		  })
	  },
	  toQuota(){
		  this.show = false
		  uni.navigateTo({
		  	url:'/pages/quota/quota'
		  })
	  },
	  toVip(){
		  this.show = false
		  uni.navigateTo({
		  	url:'/pages/VIP/VIP'
		  })
	  },
	  toCommunity(){
		  this.show = false
		  uni.navigateTo({
		  	url:'/pages/community/community'
		  })
	  }
    }
  }
</script>
<style>
	.list1{
		margin: 108rpx 0 0 40rpx;
		display: flex;
	}
	.list2,.list3{
		margin-top: 50rpx;
	}
	.list1 .word{
		width: 284rpx;
		height: 50rpx;
		font-size: 36rpx;
		font-family: PingFangSC-Semibold, PingFang SC;
		font-weight: 600;
		color: #2C2C2C;
		line-height: 50rpx;
	}
	.list3 .word{
		/* width: 284rpx; */
		height: 50rpx;
		font-size: 36rpx;
		font-family: Arial-BoldMT, Arial;
		font-weight: normal;
		color: #919191;
		line-height: 42rpx;
	}
	.list1 image{
		width: 16rpx;
		height: 26rpx;
		margin: 12rpx 60rpx 0 216rpx;
	}
	/deep/.u-transition{
		border-radius: 0 16rpx 0 0;
		overflow: hidden;
	}
	.list{
		    width: unset;
		    height: unset;
		    object-fit: unset;
		    box-shadow: unset;
		    margin-top: unset;
		    border-radius: unset;
	}
</style>